//
//  Test23.cpp
//  CPPTest
//
//  Created by you5 Yi on 2021/9/25.
//

#include "Test23.hpp"
#include <iostream>
using namespace std;
void sort3(int L[],int n)
{
    int j,k,flag,temp;
    flag = n - 1;
    while (flag > 0) {
        k = flag - 1;
        flag = 0;
        for (j=0; j<=k; j++) {
            if (L[j]>L[j+1]) {
                temp = L[j];
                L[j] = L[j+1];
                L[j+1] = temp;
                flag = j;
                cout<<"运算过程是:";
                for (int k=0; k<n; k++) {
                    cout<<L[k]<<" ";
                }
                cout<<endl;
            }
        }
    }
}

void test23() {
    int array[4] = {7,2,3,4};
    sort3(array, 4);
    cout<<"The sorted numbers:";
    for (int i=0; i<4; i++) {
        cout<<array[i];
    }
}
